/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.campaign.entities;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author Tai Nguyen
 */
public class TypeOffer {

    private int offerID;
    private String offerName;
    private float cost;
    private String lastError;

    /**
     *
     * @return boolean value
     */
    public boolean validate() {
        Pattern pattern = Pattern.compile("[0-9]+[.]?[0-9]+");
        Matcher m = pattern.matcher(String.valueOf(cost));
        if (!m.matches()) {
            setLastError("Please enter numeric value for Cost!");
            return false;
        }
        return true;

    }

    /**
     * @return the offerID
     */
    public int getOfferID() {
        return offerID;
    }

    /**
     * @param offerID the offerID to set
     */
    public void setOfferID(int offerID) {
        this.offerID = offerID;
    }

    /**
     * @return the offerName
     */
    public String getOfferName() {
        return offerName;
    }

    /**
     * @param offerName the offerName to set
     */
    public void setOfferName(String offerName) {
        this.offerName = offerName;
    }

    /**
     * @return the costForPer
     */
    public float getCost() {
        return cost;
    }

    /**
     * @param costForPer the costForPer to set
     */
    public void setCost(float cost) {
        this.cost = cost;
    }

    /**
     * @return the lastError
     */
    public String getLastError() {
        return lastError;
    }

    /**
     * @param lastError the lastError to set
     */
    public void setLastError(String lastError) {
        this.lastError = lastError;
    }
}
